
import React from 'react'
import { connect } from 'dva'
import { Popover, Form, Button, Modal, Row, Col, Input, Select, Cascader, Icon, Checkbox, Tabs, DatePicker, message } from 'antd'
import config from 'config/config'
import { mapStateToProps } from 'utils/view_utils'
import styles from './buoyManagementDetailStyle.less'
import classnames from 'classnames/bind';
let cx = classnames.bind(styles);
import Uploader from 'widget/Upload'
import moment from 'moment';
import { isEmpty, isArray, cloneDeep, set, get, pick } from 'lodash'
import { CollapsiblePanels } from 'widget/CollapsiblePanels/index'
import SelectModal from 'widget/selectProjectModal/index'
// 引入列表页组件
import ListPage from 'widget/PageTmpl/ListPage'
import FlagBtn from 'widget/FlagBtn/FlagView'
const { TextArea } = Input;
const objhref = {
    1: '推介',
    2: '秒杀竞拍',
    3: '资讯',
    4: '外部链接',
    5: '活动',
    6: '预约看房',
    7: '美房详情',
    8: '不跳转',
    9: '优惠券',
    10: '自助购房',
    11: '在线开盘',
    12: '小游戏',
    13: '直播'
}
let tip = '每个城市只能同时上架一个浮标广告'
//(1:推介 2：秒杀竞拍 3：资讯 4:外部链接 5：活动，6：预约看房，7：美房详情)
const FormItem = Form.Item
const { RangePicker } = DatePicker
const TabPane = Tabs.TabPane
const confirm = Modal.confirm;
const buoyManagementDetailView = function ({ dispatch, model, form }) {
    const { getFieldDecorator, validateFields } = form
    const { modelObj, namespace } = model
    let { loadingGroup,ignoreReason, confirmAudit, slideshowId, auditDesc, btnLoading, query, city, actionType, hrefModalObj, projectList, biz, gif, currentItem, areaList1, channelIndex = 1, value, localGif, biz2, clique, discityList } = modelObj
    const formItemLayout = {
        labelCol: { span: 2 },
        wrapperCol: { span: 8 },
    };
    const formItemLayoutForTime = {
        labelCol: { span: 2 },
        wrapperCol: { span: 20 },
    };
    const formItemLayout1 = {
        labelCol: { span: 8 },
        wrapperCol: { span: 12 },
    };
    const formItemLayoutPro = {
        labelCol: { span: 6 },
        wrapperCol: { span: 14 },
    };
    const formItemLayout2 = {
        labelCol: { span: 4 },
        wrapperCol: { span: 16 },
    };
    const formItemLayoutPro2 = {
        labelCol: { span: 4 },
        wrapperCol: { span: 20 },
    };
    const changeState = (payload) => {
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { ...payload }
        })
    }
    function updateModal(flag = false, obj = {}) {
        console.log(hrefModalObj)
        let visible = flag
        hrefModalObj.visible = flag
        if (!visible) { //关闭
            changeState({ hrefModalObj, })
            return false
        }
        form.resetFields(['new_href'])
        form.resetFields(['hrefType'])
        changeState({ hrefModalObj })
    }


    const confirmHref = (getHref) => {
        let hrefInfo = {};
        let { visible = false, hrefType = '4', idx = 0, slideshowId = '' } = hrefModalObj;
        hrefModalObj.visible = !visible;
        query.linkType = hrefModalObj.hrefType;
        if (hrefType == '4') {
            if (hrefModalObj.linkUrl && !hrefModalObj.linkUrl.trim()) {
                message.warn('请输入链接')
                return false
            }
            hrefModalObj.linkUrl = hrefModalObj.outerlinkUrl || hrefModalObj.linkUrl
            hrefInfo = getHref(cloneDeep(hrefModalObj))
        } else {
            let selectedRows = (biz[hrefType] || {})['selectedRows'] || {}
            let selectedRowKeys = (biz[hrefType] || {})['selectedRowKeys'] || {}
            if (isEmpty(selectedRowKeys) && hrefType != '8') {
                message.warn('请选择');
                return false;
            } else {
                hrefModalObj.btnName = "";
                hrefModalObj.linkUrl = null
            }
            if (selectedRows[0]) {
                let obj = { ...cloneDeep(hrefModalObj), ...cloneDeep(selectedRows[0]) }
                hrefInfo = getHref(obj)
            } else {
                let obj = {
                    ...cloneDeep(hrefModalObj),
                    contentId: hrefModalObj.params && hrefModalObj.params.contentId,
                    productId: hrefModalObj.params && hrefModalObj.params.productId
                }
                hrefInfo = getHref(obj)
            }
            currentItem = selectedRowKeys
        };
        hrefInfo.linkUrl = hrefInfo.linkUrl[0];
        hrefModalObj = { ...hrefModalObj, ...hrefInfo }
        Object.keys(biz).map((item, idx) => {
            if (hrefModalObj.hrefType != item) {
                biz[item].selectedRowKeys = []
            }
        })
        changeState({ hrefModalObj, currentItem, biz })
    }
    function getTopicList(channelIndex = '1') { //1美的置业云 2智美分销
        let rows = [
            // {
            //   'id': '1',
            //   'title': '首页',
            //   'linkUrl': '/pages/biz/index/index',
            // },
            {
                'id': '2',
                'title': '领优惠券',
                'linkUrl': '/pages/biz/my/myCoupons/couponsList/couponsList',
            },
            // {
            //   'id': '3',
            //   'title': '秒杀专题',
            //   'linkUrl': '/pages/biz/kill/killHome/killHome',
            // },
            // {
            //   'id': '4',
            //   'title': '竞拍专题',
            //   'linkUrl': '/pages/biz/auctions/auction/auction',
            // },
        ]

        let toppicList = {
            // "pageNo": 1,
            'pageSize': 10,
            'rows': cloneDeep(rows),
            'success': true,
            // "total": 150
        }
        return toppicList
    }
    let pageProps = {
        '1': {   //我要推介
            // ---------- 界面部分 ----------
            ui: {
                // 页面接口地址
                api_url: 'admin/estate/adminList',
                // 接口方式
                method: 'POST',
                headers: {
                    'Content-type': 'application/json'
                },
                app: '',
                selectedRowKeys: [],

                // 接口参数
                params: 'pageNo=1&pageSize=10&shelfStatus=1',
                // 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
                // "mockData": mockData,
                mockData: null,
                // 查询栏
                search_bar: {
                    fields: [
                        {
                            en_name: 'province',
                            zh_name: '城市',
                            elem_type: 'Cascader',
                            elem_valid_type: 'string',
                            changeOnSelect: true,
                            cmpt_items: areaList1,
                            split_keys: ['province', 'city'],
                        },
                        {
                            en_name: 'name',
                            zh_name: '项目名称',
                            elem_type: 'Input',
                            elem_valid_type: 'string',
                        },
                    ],

                    pasteTargetList: [  // 列表组件中将输入框的en_name作为默认id(也可以通过id另外设置)
                        'carName',  // 将需要粘贴事件拦截的输入框id以数组的形式传入, 该参数对应PasteFromClipboard组件的targetList参数
                    ]
                },
                // 数据表格
                'table':
                {
                    rowSelectionInfo: {
                        type: 'radio',
                    },

                    key: 'productId',
                    status_params: 'status=0',
                    status_text: '全部',
                    // 表头字段列表
                    scroll: { x: 800 },
                    fields: [
                        {
                            en_name: 'productCode',
                            zh_name: '项目编号',
                            // width: 150,
                        },
                        {
                            en_name: 'name',
                            zh_name: '项目名称',
                            // width: 100,
                        },
                        {
                            en_name: 'cityName',
                            zh_name: '所属城市',
                            width: 150,
                            // width: 100,
                            render: (a, item, index, d, e, f) => {
                                //console.log(item)
                                let arr = ['北京市', '重庆', '上海', '天津']
                                if (arr.indexOf(item.provinceName) > -1) {
                                    return item.cityName
                                } else {
                                    return `${item.provinceName || ''}${item.provinceName && item.cityName && ' - ' || ''}${item.cityName || ''}`
                                }

                            }
                        },
                        {
                            en_name: 'shelfStatus',
                            zh_name: '状态',
                            width: 80,
                            render: (a, item, index, d, e, f) => {
                                let shelfStatus = ['未上架', '已上架', '已下架']
                                return (
                                    <span>{shelfStatus[item.shelfStatus]}</span>
                                )
                            }
                        },
                        {
                            en_name: 'createPerson',
                            zh_name: '创建人',
                            // width: 100,
                        },
                        {
                            en_name: 'createTime',
                            zh_name: '创建时间',
                            width: 180
                        },
                    ],
                    // 表格操作
                    actions: [],
                },
                action_bar: [
                    {
                        // label:'',
                        // type:'',
                        rowSelection: [],
                        render: () => {
                            return <Input hidden />
                        },
                        onClick: (e, row) => {
                            console.log(e, row)
                        }
                    },
                ]
            },
        },
        '2': {   //秒杀竞拍
            // ---------- 界面部分 ----------
            ui: {
                // 页面接口地址
                // api_url: "",
                api_url: 'admin/seckillActivity/advertList',
                method: 'POST',
                headers: {
                    'Content-type': 'application/json'
                },
                app: '',
                // 接口参数
                params: 'published=2',
                // 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
                // "mockData": mockData,
                mockData: null,
                search_bar: {
                    fields: [
                        {
                            en_name: 'province',
                            zh_name: '省市',
                            elem_type: 'Cascader',
                            elem_valid_type: 'string',
                            cmpt_items: areaList1,
                            split_keys: ['province', 'city'],
                            //关联的更改的搜索字段
                            related_key: 'businessId',
                            //请求地址
                            related_req_url: 'admin/estate/adminList',
                            //默认请求
                            related_req_param: {
                                pageNo: 1,
                                pageSize: 1000
                            }
                        },
                        {
                            en_name: 'businessId',
                            zh_name: '项目名称',
                            elem_type: 'Select',
                            elem_valid_type: 'string',
                            cmpt_items: []
                        },
                        {
                            en_name: 'sellType',
                            zh_name: '活动类型',
                            elem_type: 'Select',
                            elem_valid_type: 'string',
                            cmpt_items: [{ value: 1, label: '秒杀' }, { value: 2, label: '竞拍' }]
                        },
                        // {
                        //   en_name: 'title',
                        //   zh_name: '资讯标题',
                        //   elem_type: 'Input',
                        //   elem_valid_type: 'string',
                        // }

                    ],
                    pasteTargetList: [  // 列表组件中将输入框的en_name作为默认id(也可以通过id另外设置)
                        'channel',  // 将需要粘贴事件拦截的输入框id以数组的形式传入, 该参数对应PasteFromClipboard组件的targetList参数
                    ]
                },
                // 数据表格
                'table':
                {
                    rowSelectionInfo: {
                        type: 'radio',
                    },
                    key: 'id',
                    status_params: 'status=0',
                    status_text: '全部',
                    // 表头字段列表
                    scroll: { x: 800 },
                    fields: [
                        {
                            en_name: 'name',
                            zh_name: '活动名称',
                        },
                        {
                            en_name: 'type',
                            zh_name: '活动类型',
                            render: (text) => {
                                return (
                                    <span>{['', '秒杀', '竞拍'][text]}</span>
                                )
                            }
                        },
                        {
                            en_name: 'productNames',
                            zh_name: '所属项目',
                        },
                        {
                            en_name: 'productCitys',
                            zh_name: '所属城市',
                        },
                    ],
                    // 表格操作
                    actions: [],
                    pagination: {

                    },
                },
                action_bar: [
                    {
                        // label:'',
                        // type:'',
                        rowSelection: [],
                        render: () => {
                            return <Input hidden />
                        },
                        onClick: (e, row) => {
                            console.log(e, row)
                        }
                    },
                ]
            },
        },
        '3': {  //资讯
            // ---------- 界面部分 ----------
            ui: {
                // 页面接口地址
                api_url: 'admin/news/list',
                // 接口方式
                method: 'POST',
                // "data_field_name":"data",
                app: '',
                // 接口参数
                params: 'channel=1',
                // 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
                // "mockData": mockData,
                mockData: null,
                search_bar: {
                    fields: [
                        {
                            en_name: 'province',
                            zh_name: '省市',
                            elem_type: 'Cascader',
                            elem_valid_type: 'string',
                            cmpt_items: areaList1,
                            split_keys: ['province', 'city'],
                            //关联的更改的搜索字段
                            related_key: 'businessId',
                            //请求地址
                            related_req_url: 'admin/estate/adminList',
                            //默认请求
                            related_req_param: {
                                pageNo: 1,
                                pageSize: 1000
                            }
                        },
                        {
                            en_name: 'businessId',
                            zh_name: '项目名称',
                            elem_type: 'Select',
                            elem_valid_type: 'string',
                            cmpt_items: []
                        },
                        {
                            en_name: 'title',
                            zh_name: '资讯标题',
                            elem_type: 'Input',
                            elem_valid_type: 'string',
                        }

                    ],
                    pasteTargetList: [  // 列表组件中将输入框的en_name作为默认id(也可以通过id另外设置)
                        'channel',  // 将需要粘贴事件拦截的输入框id以数组的形式传入, 该参数对应PasteFromClipboard组件的targetList参数
                    ]
                },
                // 数据表格
                'table':
                {
                    rowSelectionInfo: {
                        type: 'radio',
                    },
                    key: 'contentId',
                    status_params: 'status=0',
                    status_text: '全部',
                    // 表头字段列表
                    scroll: { x: 800 },
                    fields: [
                        {
                            en_name: 'title',
                            zh_name: '资讯标题',
                            width: 180
                        },
                        {
                            en_name: 'channel',
                            zh_name: '资讯类型',
                            width: 100,
                            render: (a, item, index, d, e, f) => {
                                if (item.channel == 1) {
                                    item.channel = '动态资讯'
                                } else if (item.channel == 3) {
                                    item.channel = '活动报名'
                                }
                                return (
                                    <span>{item.channel}</span>
                                )
                            }
                        },
                        {
                            en_name: 'businessName',
                            zh_name: '项目名称',
                        },
                        {
                            en_name: 'createTime',
                            zh_name: '更新时间',
                            width: 360
                        },
                    ],
                    // 表格操作
                    actions: [],
                },
                action_bar: [
                    {
                        // label:'',
                        // type:'',
                        rowSelection: [],
                        render: () => {
                            return <Input hidden />
                        },
                        onClick: (e, row) => {
                            console.log(e, row)
                        }
                    },
                ]
            },
        },
        '5': {  //活动
            // ---------- 界面部分 ----------
            ui: {
                // 页面接口地址
                api_url: 'admin/news/list',
                // 接口方式
                method: 'POST',
                // "data_field_name":"data",
                app: '',
                // 接口参数
                params: 'channel=3&status=1&published=1',
                // 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
                // "mockData": mockData,
                mockData: null,
                search_bar: {
                    fields: [
                        {
                            en_name: 'province',
                            zh_name: '省市',
                            elem_type: 'Cascader',
                            elem_valid_type: 'string',
                            cmpt_items: areaList1,
                            split_keys: ['province', 'city'],
                            //关联的更改的搜索字段
                            related_key: 'businessId',
                            //请求地址
                            related_req_url: 'admin/estate/adminList',
                            //默认请求
                            related_req_param: {
                                pageNo: 1,
                                pageSize: 1000
                            }
                        },
                        {
                            en_name: 'businessId',
                            zh_name: '项目名称',
                            elem_type: 'Select',
                            elem_valid_type: 'string',
                            cmpt_items: []
                        },
                        {
                            en_name: 'title',
                            zh_name: '标题',
                            elem_type: 'Input',
                            elem_valid_type: 'string',
                        }

                    ],
                    pasteTargetList: [  // 列表组件中将输入框的en_name作为默认id(也可以通过id另外设置)
                        'channel',  // 将需要粘贴事件拦截的输入框id以数组的形式传入, 该参数对应PasteFromClipboard组件的targetList参数
                    ]
                },
                // 数据表格
                'table':
                {
                    rowSelectionInfo: {
                        type: 'radio',
                    },
                    key: 'contentId',
                    status_params: 'status=0',
                    status_text: '全部',
                    // 表头字段列表
                    scroll: { x: 800 },
                    fields: [
                        {
                            en_name: 'title',
                            zh_name: '资讯标题',
                            width: 180
                        },
                        {
                            en_name: 'channel',
                            zh_name: '类型',
                            width: 100,
                            render: (a, item, index, d, e, f) => {
                                if (item.channel == 1) {
                                    item.channel = '动态资讯'
                                } else if (item.channel == 3) {
                                    item.channel = '活动报名'
                                }
                                return (
                                    <span>{item.channel}</span>
                                )
                            }
                        },
                        {
                            en_name: 'businessName',
                            zh_name: '项目名称',
                        },
                        {
                            en_name: 'createTime',
                            zh_name: '更新时间',
                            width: 360
                        },
                    ],
                    // 表格操作
                    actions: [],
                },
                action_bar: [
                    {
                        // label:'',
                        // type:'',
                        rowSelection: [],
                        render: () => {
                            return <Input hidden />
                        },
                        onClick: (e, row) => {
                            console.log(e, row)
                        }
                    },
                ]
            },
        },
        '6': {   //预约看房
            // ---------- 界面部分 ----------
            ui: {
                // 页面接口地址
                api_url: 'admin/estate/adminList',
                // 接口方式
                method: 'POST',
                headers: {
                    'Content-type': 'application/json'
                },
                app: '',
                // 接口参数
                params: 'pageNo=1&pageSize=10&shelfStatus=1',
                // 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
                // "mockData": mockData,
                mockData: null,
                // 查询栏
                search_bar: {
                    fields: [
                        {
                            en_name: 'province',
                            zh_name: '城市',
                            elem_type: 'Cascader',
                            elem_valid_type: 'string',
                            changeOnSelect: true,
                            cmpt_items: areaList1,
                            split_keys: ['province', 'city'],
                        },
                        {
                            en_name: 'name',
                            zh_name: '项目名称',
                            elem_type: 'Input',
                            elem_valid_type: 'string',
                        },
                    ],

                    pasteTargetList: [  // 列表组件中将输入框的en_name作为默认id(也可以通过id另外设置)
                        'carName',  // 将需要粘贴事件拦截的输入框id以数组的形式传入, 该参数对应PasteFromClipboard组件的targetList参数
                    ]
                },
                // 数据表格
                'table':
                {
                    rowSelectionInfo: {
                        type: 'radio',
                    },
                    key: 'productId',
                    status_params: 'status=0',
                    status_text: '全部',
                    // 表头字段列表
                    scroll: { x: 800 },
                    fields: [
                        {
                            en_name: 'estateCode',
                            zh_name: '项目编号',
                            // width: 150,
                        },
                        {
                            en_name: 'name',
                            zh_name: '项目名称',
                            // width: 100,
                        },
                        {
                            en_name: 'cityName',
                            zh_name: '所属城市',
                            width: 150,
                            // width: 100,
                            render: (a, item, index, d, e, f) => {
                                //console.log(item)
                                let arr = ['北京市', '重庆', '上海', '天津']
                                if (arr.indexOf(item.provinceName) > -1) {
                                    return item.cityName
                                } else {
                                    return `${item.provinceName || ''}${item.provinceName && item.cityName && ' - ' || ''}${item.cityName || ''}`
                                }

                            }
                        },
                        {
                            en_name: 'shelfStatus',
                            zh_name: '状态',
                            width: 80,
                            render: (a, item, index, d, e, f) => {
                                let shelfStatus = ['未上架', '已上架', '已下架']
                                return (
                                    <span>{shelfStatus[item.shelfStatus]}</span>
                                )
                            }
                        },
                        {
                            en_name: 'createPerson',
                            zh_name: '创建人',
                            // width: 100,
                        },
                        {
                            en_name: 'createTime',
                            zh_name: '创建时间',
                            width: 180
                        },
                    ],
                    // 表格操作
                    actions: [],
                },
                action_bar: [
                    {
                        // label:'',
                        // type:'',
                        rowSelection: [],
                        render: () => {
                            return <Input hidden />
                        },
                        onClick: (e, row) => {
                            console.log(e, row)
                        }
                    },
                ]
            },
        },
        '7': {   //美房详情
            // ---------- 界面部分 ----------
            ui: {
                // 页面接口地址
                api_url: 'admin/estate/adminList',
                // 接口方式
                method: 'POST',
                headers: {
                    'Content-type': 'application/json'
                },
                app: '',
                selectedRowKeys: [],
                // 接口参数
                params: 'pageNo=1&pageSize=10&shelfStatus=1',
                // 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
                // "mockData": mockData,
                mockData: null,
                // 查询栏
                search_bar: {
                    fields: [
                        {
                            en_name: 'province',
                            zh_name: '城市',
                            elem_type: 'Cascader',
                            elem_valid_type: 'string',
                            changeOnSelect: true,
                            cmpt_items: areaList1,
                            split_keys: ['province', 'city'],
                        },
                        {
                            en_name: 'name',
                            zh_name: '项目名称',
                            elem_type: 'Input',
                            elem_valid_type: 'string',
                        },
                    ],

                    pasteTargetList: [  // 列表组件中将输入框的en_name作为默认id(也可以通过id另外设置)
                        'carName',  // 将需要粘贴事件拦截的输入框id以数组的形式传入, 该参数对应PasteFromClipboard组件的targetList参数
                    ]
                },
                // 数据表格
                'table':
                {
                    rowSelectionInfo: {
                        type: 'radio',
                    },

                    key: 'productId',
                    status_params: 'status=0',
                    status_text: '全部',
                    // 表头字段列表
                    scroll: { x: 800 },
                    fields: [
                        {
                            en_name: 'estateCode',
                            zh_name: '项目编号',
                            // width: 150,
                        },
                        {
                            en_name: 'name',
                            zh_name: '项目名称',
                            // width: 100,
                        },
                        {
                            en_name: 'cityName',
                            zh_name: '所属城市',
                            width: 150,
                            // width: 100,
                            render: (a, item, index, d, e, f) => {
                                //console.log(item)
                                let arr = ['北京市', '重庆', '上海', '天津']
                                if (arr.indexOf(item.provinceName) > -1) {
                                    return item.cityName
                                } else {
                                    return `${item.provinceName || ''}${item.provinceName && item.cityName && ' - ' || ''}${item.cityName || ''}`
                                }

                            }
                        },
                        {
                            en_name: 'shelfStatus',
                            zh_name: '状态',
                            width: 80,
                            render: (a, item, index, d, e, f) => {
                                let shelfStatus = ['未上架', '已上架', '已下架']
                                return (
                                    <span>{shelfStatus[item.shelfStatus]}</span>
                                )
                            }
                        },
                        {
                            en_name: 'createPerson',
                            zh_name: '创建人',
                            // width: 100,
                        },
                        {
                            en_name: 'createTime',
                            zh_name: '创建时间',
                            width: 180
                        },
                    ],
                    // 表格操作
                    actions: [],
                },
                action_bar: [
                    {
                        // label:'',
                        // type:'',
                        rowSelection: [],
                        render: () => {
                            return <Input hidden />
                        },
                        onClick: (e, row) => {
                            console.log(e, row)
                        }
                    },
                ]
            },
        },
        '9': {   //专题活动
            // ---------- 界面部分 ----------
            ui: {
                // 页面接口地址
                // api_url: "",
                api_url: '',
                // 接口方式
                method: 'POST',
                // "data_field_name":"data",
                app: '',
                // 接口参数
                params: '',
                // 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
                // "mockData": mockData,
                mockData: cloneDeep(getTopicList()),
                // 数据表格
                'table':
                {
                    rowSelectionInfo: {
                        type: 'radio',
                    },
                    key: 'id',
                    status_params: 'status=0',
                    status_text: '全部',
                    // 表头字段列表
                    scroll: { x: 800 },
                    fields: [
                        {
                            en_name: 'title',
                            zh_name: '标题',
                        },
                        {
                            en_name: 'linkUrl',
                            zh_name: '链接',
                        },
                    ],
                    // 表格操作
                    actions: [],
                    pagination: {

                    },
                },
                action_bar: [
                    {
                        // label:'',
                        // type:'',
                        rowSelection: [],
                        render: () => {
                            return <Input hidden />
                        },
                        onClick: (e, row) => {
                            console.log(e, row)
                        }
                    },
                ]
            },
        },
        '10': {  //自助购房
            ui: {
                // 页面接口地址
                api_url: 'admin/liveBroadcast/queryPageByProjectId',
                // 接口方式
                method: 'POST',
                headers: {
                    'Content-type': 'application/json'
                },
                app: '',
                selectedRowKeys: [],
                // 接口参数
                params: `pageNo=1&pageSize=10`,
                // 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
                // "mockData": mockData,
                mockData: null,
                // 查询栏
                search_bar: {
                    fields: [
                        {
                            en_name: 'activityName',
                            zh_name: '活动名称',
                            elem_type: 'Input',
                            elem_valid_type: 'string',
                        },
                        {
                            en_name: 'projectName',
                            zh_name: '项目名称',
                            elem_type: 'Input',
                            elem_valid_type: 'string',
                        },
                    ],

                    pasteTargetList: [  // 列表组件中将输入框的en_name作为默认id(也可以通过id另外设置)
                        'carName',  // 将需要粘贴事件拦截的输入框id以数组的形式传入, 该参数对应PasteFromClipboard组件的targetList参数
                    ]
                },
                // 数据表格
                'table':
                {
                    rowSelectionInfo: {
                        type: 'radio',
                    },

                    key: 'productId',
                    status_params: 'status=0',
                    status_text: '全部',
                    // 表头字段列表
                    scroll: { x: 800 },
                    fields: [
                        {
                            en_name: 'activityName',
                            zh_name: '活动名称',
                            // width: 150,
                        },
                        {
                            en_name: 'zsxfsj',
                            zh_name: '正式选房时间',
                            width: 180,
                            render: (a, item, index, d, e, f) => {
                                return <span>{item.selectStartTime}~{item.selectEndTime}</span>
                            }
                        }
                    ],
                    // 表格操作
                    actions: [],
                },
                action_bar: [
                    {
                        // label:'',
                        // type:'',
                        rowSelection: [],
                        render: () => {
                            return <Input hidden />
                        },
                        onClick: (e, row) => {
                            console.log(e, row)
                        }
                    },
                ]
            },
        },
        '11': {  //在线选房
            ui: {
                // 页面接口地址
                api_url: 'admin/liveBroadcast/queryPageByProjectId',
                // 接口方式
                method: 'POST',
                headers: {
                    'Content-type': 'application/json'
                },
                app: '',
                selectedRowKeys: [],
                // 接口参数
                params: `pageNo=1&pageSize=10&type=0`,
                // 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
                // "mockData": mockData,
                mockData: null,
                // 查询栏
                search_bar: {
                    fields: [
                        {
                            en_name: 'activityName',
                            zh_name: '活动名称',
                            elem_type: 'Input',
                            elem_valid_type: 'string',
                        },
                        {
                            en_name: 'projectName',
                            zh_name: '项目名称',
                            elem_type: 'Input',
                            elem_valid_type: 'string',
                        },
                    ],

                    pasteTargetList: [  // 列表组件中将输入框的en_name作为默认id(也可以通过id另外设置)
                        'carName',  // 将需要粘贴事件拦截的输入框id以数组的形式传入, 该参数对应PasteFromClipboard组件的targetList参数
                    ]
                },
                // 数据表格
                'table':
                {
                    rowSelectionInfo: {
                        type: 'radio',
                    },

                    key: 'productId',
                    status_params: 'status=0',
                    status_text: '全部',
                    // 表头字段列表
                    scroll: { x: 800 },
                    fields: [
                        {
                            en_name: 'activityName',
                            zh_name: '活动名称',
                            // width: 150,
                        },
                        {
                            en_name: 'zsxfsj',
                            zh_name: '正式选房时间',
                            width: 180,
                            render: (a, item, index, d, e, f) => {
                                return <span>{item.selectStartTime}~{item.selectEndTime}</span>
                            }
                        }
                    ],
                    // 表格操作
                    actions: [],
                },
                action_bar: [
                    {
                        // label:'',
                        // type:'',
                        rowSelection: [],
                        render: () => {
                            return <Input hidden />
                        },
                        onClick: (e, row) => {
                            console.log(e, row)
                        }
                    },
                ]
            },
        },
        '12': {  //小游戏
            'ui': {
                // 页面接口地址
                'api_url': 'mideadc-game-center-service/activity/gameActivity/list',
                "data_field_name": "result.records",
                "data_pageNo": "result.current",
                "data_pageSize": "result.size",
                "data_total": "result.total",
                // 接口方式
                'method': 'GET',
                'app': 'isales-mgmt-application',
                selectedRowKeys: [],
                // 接口参数
                'params': 'releaseStatus=1',
                // 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
                // "mockData": mockData,
                'mockData': null,
                // 查询栏
                'search_bar': {
                    'fields': [
                        {
                            en_name: 'title',
                            zh_name: '活动名称',
                            elem_type: 'Input',
                            elem_valid_type: 'string',
                        },
                    ],
                    searchHandler: (p) => { // 自定义搜索按钮回调函数，点击搜索时触发

                    },
                    resetHandler: (p) => { // 自定义重置按钮回调函数，点击重置时触发
                        // console.log('reset click', p)
                    },
                    searchCallback: params => { // 自定义搜索完成后的后调函数, 搜索完成后触发, 并将本次搜索的参数传入
                        // console.log('search finish', params)
                    },
                },
                // 数据表格
                'table': {
                    rowSelectionInfo: {
                        type: 'radio'
                    },
                    'status_params': 'status=0',
                    'status_text': '全部',
                    'scroll': { x: 1600 },
                    // 表头字段列表"
                    'fields': [
                        {
                            'en_name': 'gameImgUrl',
                            'zh_name': '活动类型缩略图',
                            width: 50,
                            render: (a, item, index, d, e, f) => {
                                return <img style={{ width: "50px", height: '50px' }} src={a} />
                            }
                        },
                        {
                            'en_name': 'title',
                            'zh_name': '活动名称',
                            width: 200
                        },
                        {
                            'en_name': 'uuseeConfigName',
                            'zh_name': '活动时间',
                            width: 90,
                            render: (text, item) => {
                                return <div>{`${item.startTime.split(' ')[0] || ''}${item.endTime && ' ~ ' || ''}${item.endTime.split(' ')[0] || ''}`}</div>
                            }
                        },
                        {
                            'en_name': 'type',
                            'zh_name': '活动状态',
                            width: 100,
                            render: (a, item, index, d, e, f) => {
                                if (item.status == '0') {
                                    return <div>未发布</div>
                                }
                                else if (item.status == '1') {
                                    return <div>未开始</div>
                                }
                                else if (item.status == '2') {
                                    return <div>进行中</div>
                                }
                                else if (item.status == '3') {
                                    return <div>已结束</div>
                                } else {
                                    return <div>-</div>
                                }
                            }
                        },
                        {
                            'en_name': 'createPerson',
                            'zh_name': '创建人',
                            width: 100,
                        },
                        {
                            'en_name': 'createTime',
                            'zh_name': '创建时间',
                            width: 180
                        }
                    ],

                    'actions': [
                    ],
                    "action_props": {
                        fixed: "right",
                        width: 210
                    }
                },
                // 操作栏
                action_bar: [
                    {
                        rowSelection: [],
                        render: () => {
                            return <Input hidden />
                        },
                        onClick: (e, row) => {
                            console.log(e, row)
                        }
                    },
                ]
            }
        },
        '13': {  //直播列表
            ui: {
                // 页面接口地址
                api_url: 'admin/liveBroadcast/queryList',
                // 接口方式
                method: 'POST',
                headers: {
                    'Content-type': 'application/json'
                },
                app: '',
                selectedRowKeys: [],
                // 接口参数
                params: ``,
                // 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
                // "mockData": mockData,
                mockData: null,
                // 查询栏
                search_bar: {
                    'fields': [
                        {
                            en_name: 'province',
                            zh_name: '省市',
                            elem_type: 'Cascader',
                            elem_valid_type: 'string',
                            cmpt_items: areaList1,
                            //关联的更改的搜索字段 
                            related_key: 'productId',
                            //请求地址
                            related_req_url: 'admin/estate/adminList',
                            //默认请求
                            related_req_param: {
                                pageNo: 1,
                                pageSize: 1000
                            },
                            split_keys: ['provinceCode', 'cityCode'],
                        },
                        {
                            en_name: 'productId',
                            zh_name: '项目名称',
                            elem_type: 'Select',
                            elem_valid_type: 'string',
                            cmpt_items: []
                        },
                        {
                            en_name: 'title',
                            zh_name: '直播标题',
                            elem_type: 'Input',
                            elem_valid_type: 'string',
                        },
                        {
                            en_name: 'type',
                            zh_name: '直播类型',
                            elem_type: 'Select',
                            elem_valid_type: 'string',
                            cmpt_items: [
                                {
                                    value: '3',
                                    label: '预告'
                                },
                                {
                                    value: '1',
                                    label: '直播'
                                },
                                {
                                    value: '2',
                                    label: '回放'
                                }
                            ]
                        },
                    ],

                    pasteTargetList: [  // 列表组件中将输入框的en_name作为默认id(也可以通过id另外设置)
                        'carName',  // 将需要粘贴事件拦截的输入框id以数组的形式传入, 该参数对应PasteFromClipboard组件的targetList参数
                    ]
                },
                // 数据表格
                'table': {
                    rowSelectionInfo: {
                        type: 'radio',
                    },
                    'status_params': 'status=0',
                    'status_text': '全部',
                    'scroll': { x: 1600 },
                    // 表头字段列表"
                    'fields': [
                        {
                            en_name: "key",
                            zh_name: "序号",
                            width: "60",
                            render: (a, item, index, d, e, f) => {
                                return index + 1
                            },
                        },
                        {
                            'en_name': 'city',
                            'zh_name': '城市',
                            width: 200,
                            render: (a, item, index, d, e, f) => {
                                // console.log(a, item, index, d, e, f)
                                return <span>{item.provinceName}-{item.cityName}</span>
                            }
                        },
                        {
                            'en_name': 'productName',
                            'zh_name': '项目',
                            width: 200
                        },
                        {
                            'en_name': 'title',
                            'zh_name': '直播标题',
                            width: 200
                        },
                        {
                            'en_name': 'uuseeConfigName',
                            'zh_name': '直播平台',
                            width: 90
                        },
                        {
                            'en_name': 'type',
                            'zh_name': '直播类型',
                            width: 90,
                            render: (a, item, index, d, e, f) => {
                                return <span>{{ 1: '直播', 2: '回放', 3: '预告' }[a]}</span>
                            }
                        },
                        {
                            'en_name': 'published',
                            'zh_name': '发布状态',
                            width: 90,
                            render: (a, item, index, d, e, f) => {
                                return <span>{{ 0: '未发布', 1: '已发布' }[a]}</span>
                            }
                        },
                        {
                            'en_name': 'counselorName',
                            'zh_name': '主播',
                            width: 100
                        },

                        {
                            'en_name': 'data',
                            'zh_name': '直播时间',
                            width: 180,
                            render: (a, item, index, d, e, f) => {
                                return (
                                    <div>
                                        <div>{item.effectiveStartTime}</div>
                                        <div>{item.effectiveEndTime}</div>
                                    </div>
                                )

                            }
                        }
                    ],

                    'actions': [
                    ],
                    "action_props": {
                        fixed: "right",
                        width: 210
                    }
                },
                action_bar: [
                    {
                        // label:'',
                        // type:'',
                        rowSelection: [],
                        render: () => {
                            return <Input hidden />
                        },
                        onClick: (e, row) => {
                            console.log(e, row)
                        }
                    },
                ]
            },
        },
    };

    // hrefType 链接类型//(1:推介 2：秒杀竞拍 3：资讯 4:外部链接 5：活动，6：预约看房，7：美房详情)
    (['1', '2', '3', '5', '6', '7', '9', '10', '11', '12', '13']).map((item, index) => {
        let _biz = biz[item + '']
        if (!!_biz) {
            pageProps[item + ''].biz = _biz
            pageProps[item + ''].biz.syncBackCbf = (newbiz) => {
                console.log(hrefModalObj.hrefType, item, newbiz, 'item,newbiz')
                if (item == hrefModalObj.hrefType && hrefModalObj.hrefType != 2) {
                    newbiz.selectedRowKeys = currentItem
                }
                biz[item + ''] = newbiz
                dispatch({
                    type: `${namespace}/updateStore`,
                    payload: { biz }
                })
            }
        }
    })
    // 分页表格属性配置
    let pageProps2 = {
        // ---------- 界面部分 ----------
        ui: {
            // 页面接口地址
            api_url: "admin/estate/adminList",
            // 接口方式
            method: "POST",
            headers: {
                "Content-type": "application/json"
            },
            app: "",
            // 接口参数
            params: "pageNo=1&pageSize=10&shelfStatus=1",
            // 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
            // "mockData": mockData,
            mockData: null,
            // 查询栏
            search_bar: {
                fields: [
                    {
                        en_name: 'province',
                        zh_name: '城市',
                        elem_type: 'Cascader',
                        elem_valid_type: 'string',
                        changeOnSelect: true,
                        cmpt_items: areaList1,
                        split_keys: ['province', 'city'],
                    },
                    {
                        en_name: 'name',
                        zh_name: '项目名称',
                        elem_type: 'Input',
                        elem_valid_type: 'string',
                    },
                ],

            },
            // 数据表格
            "table":

            {
                rowSelectionInfo: {
                    type: 'radio',
                },
                status_params: "status=0",
                status_text: "全部",
                // 表头字段列表

                key: 'productId',
                fields: [
                    {
                        en_name: "name",
                        zh_name: "项目名称",
                        width: 180,
                    },
                    {
                        en_name: "cityName",
                        zh_name: "所属城市",
                        width: 150,
                        render: (a, item, index, d, e, f) => {
                            //console.log(item)
                            let arr = ['北京市', '重庆', '上海', '天津']
                            if (arr.indexOf(item.provinceName) > -1) {
                                return item.cityName
                            } else {
                                return `${item.provinceName || ''}${item.provinceName && item.cityName && ' - ' || ''}${item.cityName || ''}`
                            }

                        }
                    },
                    {
                        en_name: "saleArea",
                        zh_name: "在售面积",
                        width: 110,
                    },
                    {
                        en_name: "avePrice",
                        zh_name: "均价(元/㎡)",
                        width: 120,
                    },
                    {
                        en_name: "propertyRight",
                        zh_name: "产权年限",
                        width: 110,
                    },

                ],
            },
            action_bar: [
                {
                    // label:'',
                    // type:'',
                    rowSelection: [],
                    render: () => {
                        return <Input hidden />
                    },
                    onClick: (e, row) => {
                        console.log(e, row)
                    }
                },
            ]
        },
    }
    if (!!modelObj.biz) {
        pageProps2.biz = modelObj.biz2
        pageProps2.biz.syncBackCbf = (biz) => {
            //console.log(biz)
            biz.selectedRowKeys = [query.productId]
            dispatch({
                type: `${namespace}/updateStore`,
                payload: { biz2: biz }
            })
        }
    }
    //动态增加form表单
    const formItems1 = query.provinceCodes && query.provinceCodes.map((k, index) => (
        <Row>
            <Col span={6}>
                <Form.Item
                    {...formItemLayout2}
                    required={false}
                    key={index}
                >
                    {getFieldDecorator(`provinceCodes[${index}]`, {
                        validateTrigger: ['onChange', 'onBlur'],
                        rules: [{
                            required: true,
                            whitespace: true,
                            message: "请选择或者删除此范围",
                        }],
                        initialValue: query.provinceCodes[index]
                    })(
                        <Select onSelect={(value, option) => { getProvince(value, option, index) }} disabled={actionType == 'detail'} >
                            {<Select.Option value='0' key='0' disabled={!JSON.parse(clique)}>全国</Select.Option>}

                            {areaList1.map((item, i) => {
                                return (
                                    <Select.Option value={item.value} key={JSON.stringify(item.children)}>{item.label}</Select.Option>
                                )
                            })}
                        </Select>
                    )}
                </Form.Item>
            </Col>

            {query.provinceCodes && query.provinceCodes.length > 1 && actionType != 'detail' ? (
                <Col span={2}>
                    <Icon
                        className="dynamic-delete-button"
                        type="minus-circle-o"
                        disabled={query.provinceCodes.length === 1}
                        onClick={() => remove(index)}
                    />
                </Col>
            ) : null}
        </Row>

    ));



    //增加全选
    function onCheckAllChange(y, e) {
        let arr = []
        if (e.target.checked) {
            city[y].forEach((item, idx) => {
                arr.push(item.value)
            })
        }
        query.cityCodes[y] = arr
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { query }
        })
        form.resetFields([`cityCodes[${y}]`])
    }
    const formItems2 = query.cityCodes && query.cityCodes.map((x, y) => (
        <div>
            <div >
                {!query.wholeCountry && query.provinceCodes[y] > 0 ? <Checkbox
                    indeterminate={query.cityCodes[y] && city[y] && query.cityCodes[y].length != 0 && (query.cityCodes[y].length != city[y].length)}
                    onChange={(e) => onCheckAllChange(y, e)}
                    checked={query.cityCodes[y] && city[y] && (query.cityCodes[y].length == city[y].length)}
                >
                    全选
            </Checkbox> : null}
            </div>
            <Form.Item
                required={false}
                key={y}
            >
                {getFieldDecorator(`cityCodes[${y}]`, {
                    initialValue: query.cityCodes[y],
                })(
                    <Checkbox.Group disabled={actionType == 'detail'} style={{ width: "100%" }} onChange={(value) => getCity(value, y)}>
                        {city[y] ? city[y].map(item => { return (<Checkbox disabled={discityList.includes(item.value) || actionType == 'detail'} value={item.value}>{item.label}</Checkbox>) }) : ''}
                    </Checkbox.Group>
                )}
            </Form.Item>

        </div>

    ));
    const formItems = formItems1 && formItems1.map((x, y) => (
        <div key={y}>{formItems1[y]}{formItems2[y]}</div>))


    //删除form表单函数
    function remove(k) {
        query.provinceCodes = query.provinceCodes.filter((key, index) => index !== k)
        query.cityCodes = query.cityCodes.filter((key, index) => index !== k)
        let mcity = city.filter((key, index) => index !== k)
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { city: mcity, query }
        });
    }
    //增加form表单函数
    function add() {
        if (query.wholeCountry) {
            message.error("已选择了全国地区，无需再添加活动地区");
            return false;
        }
        query.provinceCodes.push("")
        query.cityCodes.push([])
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { query }
        });
    }
    //判断当选择的全部城市是多选框的全国默认被选上，并且不可用
    function getProvince(e, option, i) {
        if (e == 0) {
            query.wholeCountry = true
        } else if (e != 0) {
            query.wholeCountry = false
            query.cityCodes[i] = []
            dispatch({
                type: `${namespace}/getDiscity`,
                payload: { pId: e }
            })
        }
        query.provinceCodes[Number(i)] = e
        city[i] = JSON.parse(option.key)
        form.resetFields([`cityCodes[${i}]`])
        form.resetFields([`provinceCodes[${i}]`])
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { city, query }
        });
        form.resetFields(['useRange'])
    }

    //获取所选城市
    function getCity(e, i) {
        // console.log(e)
        // console.log(i)
        // console.log(city)
        query.cityCodes[i] = e
        //query.city
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { query }
        });
    }
    //获取所选项目的城市
    function getSelected(e, option) {
        let num = JSON.parse(option.key)
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { num }
        });
    }
     //保存
  function submit() {
    validateFields((err, values) => {
      console.log(err)
      if (!err) {
        dispatch({
          type: `${namespace}/submit`,
          payload: {}
        })
      }
    });
  }
  // 验证并打开确认框
  function comfiraudit() {
    validateFields((err, values) => {
      console.log(err)
      if (!err) {
        dispatch({
          type: `${namespace}/updateStore`,
          payload: { confirmAudit: true }
        })
      }
    });
  }
  // 确认保存并提交（先调保存接口再提交）
  function confirmAuditOk() {
    dispatch({
      type: `${namespace}/submit`,
      payload: { AuditOk: true }
    })

  }
    // 驳回审核
    function ignore(params) {
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { ignoreReason: true }
        })
    }
    // 输入驳回原因
    function onChangeTextArea(e) {
        dispatch(
            {
                type: `${namespace}/updateStore`,
                payload: { auditDesc: e }
            }
        )
    }
    // 提交驳回请求
    function confirmignore() {
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { ignoreReason: false }
        })
        changAdvertisementAuditsubmit(-1, auditDesc)
    }
    // 审核通过/取消审核/驳回
    function changAdvertisementAuditsubmit(auditStatus, reson = null) {
        let params = {
            advertisementBuoysId: slideshowId,
            auditStatus,
            auditDesc: reson != null ? reson : ''
        }
        dispatch({
            type: `${namespace}/advertisementAuditsubmit`,
            payload: params
        })
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { auditDesc: '' }
        })
    }
    //上传图片
    function updateImageModel(value) {
        localGif = value,
            query.imgUrl = value
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { query, localGif }
        });
    };
    //获取动态图
    function getGif(e) {
        value = e.target.value
        //   console.log(value)  
        if (e.target.value !== 1) {
            query.imgUrl = gif[e.target.value]
            dispatch({
                type: `${namespace}/updateStore`,
                payload: { query, value }
            })
        }
    }

    //删除上传的图片
    function removeImgUrl() {
        localGif = '',
            query.imgUrl = ''
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { query, localGif }
        });
    }


    //项目选项改变时
    function projectChange(e, i) {
        // console.log(e, i, '000000')
        dispatch({
            type: `${namespace}/getActivityList`,
            payload: { businessId: e, channel: query.linkName == '/pages/biz/findHouse/activity/apply/apply' || query.location == 2 ? 3 : 1 }
        })
        inputChange(e, 'productId')
    }
    //输入框改变时
    function inputChange(e, name) {
        if (name == 'location') {
            dispatch(
                {
                    type: `${namespace}/updateStore`,
                    hrefModalObj
                }
            )
        }
        dispatch({
            type: `${namespace}/updateStore`,
            payload: {
                query: {
                    ...query,
                    [name]: e,
                }
            }
        })
    }
    //日期改变时
    function dateChange(m, s) {
        // console.log(m, s)
        dispatch({
            type: `${namespace}/updateStore`,
            payload: {
                query: {
                    ...query,
                    startTime: s[0],
                    endTime: s[1],
                }
            }
        })
    }
    function openModal() {
        hrefModalObj.secvisible = true
        form.resetFields(['productId'])
        changeState({ hrefModalObj })
    }
    // 处理审核状态
    function filterAudit(params) {
        switch (params) {
            case -1:
                return '审核驳回'
                break;
            case 0:
                return '待审核'
                break;
            case 1:
                return '审核中'
                break;
            case 2:
                return '已审核'
                break;
        }
    }
    return (
        <div className={cx('pageLayout')}>
            <div className='public_listMain'>
                <div className={"functionButton"}>
                    {
                        (actionType == "detail" || actionType == "edit") && query.auditDesc && query.auditStatus === -1 ?
                            <FlagBtn node={<span>
                                <Icon type="close-circle" className={cx('close-circle')} />
                                <span className={cx('ml10')}>审核被驳回</span>
                                <Popover placement="bottom" content={query.auditDesc}>
                                    <span className={[cx('ml10'), cx('mr30')].join(' ')}>驳回原因</span>
                                </Popover>
                            </span>} btnId={''}> </FlagBtn>
                            : ''
                    }
                    {/* 审核状态：auditStatus    -1审核驳回，0待审核，1审核中，2已审核 */}
                    {actionType == "edit" && query.auditStatus === 2 ?
                        <FlagBtn node={<Button type='primary' ghost onClick={(e) => changAdvertisementAuditsubmit(0)} loading={loadingGroup['0']}>取消审核</Button>} btnId={'30604'}> </FlagBtn>
                        : null}
                    {actionType == "edit" && query.auditStatus === 1 ?
                        <FlagBtn node={<Button className={cx('ml15')} type='primary' ghost onClick={(e) => ignore()} loading={loadingGroup['-1']}>驳回</Button>} btnId={'30604'}> </FlagBtn>
                        : null}
                    {actionType == "edit" && query.auditStatus === 1?
                        <FlagBtn node={<Button className={cx('ml15')} type='primary' onClick={() => changAdvertisementAuditsubmit(2)} loading={loadingGroup['2']}>审核通过</Button>} btnId={'30604'}> </FlagBtn>
                        : null}
                    {actionType == "add" ||( actionType == "edit"&&query.auditStatus <= 0 )?
                        <FlagBtn node={<Button type='primary' className={cx('ml15')} onClick={() => submit()} loading={btnLoading}>保存</Button>} btnId={'30603'}> </FlagBtn>
                        : null}
                    {actionType == "add" ||( actionType == "edit"&&query.auditStatus <= 0 )?
                        <FlagBtn node={<Button type='primary' className={cx('ml15')} onClick={() => comfiraudit()} loading={loadingGroup['1']}>提交审核</Button>} btnId={'30601'}> </FlagBtn>
                        : null}
                </div>

                <CollapsiblePanels title="浮标广告信息" auditStatus={actionType != "add" ? `审核状态：${filterAudit(query.auditStatus)}` : ''} hideUpDownBtn={true} sTitle={actionType == 'detail' ? `状态：${['未上架', '已上架', '已下架'][query.status]}` : ''}>
                    <Row>
                        <Col span={8}>
                            <FormItem label='投放位置'  {...formItemLayoutPro}>
                                {getFieldDecorator('location', {
                                    rules: [{
                                        required: true, message: '请输入投放位置'
                                    }],
                                    initialValue: query.location || query.location == 0 ? query.location + "" : undefined
                                })(
                                    <Select disabled={actionType == 'detail'} placeholder='请选择投放位置' onChange={(e) => {
                                        delete hrefModalObj.btnName
                                        dispatch({
                                            type: `${namespace}/updateStore`,
                                            payload: {
                                                hrefModalObj,
                                                query, biz
                                            }
                                        })

                                        inputChange(e, 'location')
                                    }}>
                                        <Select.Option value="1">首页</Select.Option>
                                        <Select.Option value="2">福利</Select.Option>
                                    </Select>
                                )}
                            </FormItem>
                        </Col>
                    </Row>
                    <Row>
                        <Col span={8}>
                            <FormItem label='广告名称'  {...formItemLayoutPro}>
                                {getFieldDecorator('title', {
                                    rules: [{
                                        required: true, whitespace: true, message: '请输入广告名称'
                                    }],
                                    initialValue: query.title ? query.title + '' : undefined
                                })(
                                    <Input disabled={actionType == 'detail'} placeholder='请输入广告名称' onChange={(e) => { inputChange(e.target.value, 'title') }} />
                                )}
                            </FormItem>
                        </Col>
                    </Row>
                    <FormItem
                        {...formItemLayout}
                        extra="图片分辨率需为200px*200px，且文件大小在500KB以下，支持jpg，png，gif格式"
                        label="浮标图片"
                        required='true'
                    >
                        <Uploader uploadedUrls={query.imgUrl}
                            removeFileCbf={() => { removeImgUrl() }}
                            uploadSuccessCbf={(imgUrl) => { updateImageModel(imgUrl) }}
                            showType={actionType == 'detail' ? '4' : '6'}
                            minCropBoxWidth={200}
                            minCropBoxHeight={200}
                            unsetWidth={true}
                            fileType='imageGif'
                            accept=".jpg,.png,.gif"
                            fileMaxSize='0.5'
                            maxFiles='1'
                            disabled={actionType == 'detail'}
                        />
                    </FormItem>
                    <Row>
                        <Col span={6}>
                            <FormItem label='跳转页面' required='true' {...formItemLayout1}>
                                {getFieldDecorator('hrefType', {
                                    rules: [{
                                        validator: function (rule, str, callback) {
                                            if (hrefModalObj.linkUrl || query.linkType == '8') {
                                                callback();
                                            } else {
                                                callback('请选择链接');
                                            }
                                        }//todo
                                    }
                                    ],
                                })(
                                    <Col span={6}>
                                        <Button onClick={() => { updateModal(true) }}>选择链接</Button>
                                    </Col>
                                )}

                            </FormItem>
                        </Col>

                        {hrefModalObj.btnName ? <Col span={8} >
                            <FormItem>
                                <span><span style={{ fontSize: 12 }}> 名称: </span> {hrefModalObj.btnName}</span>
                            </FormItem>
                        </Col> : null}
                        {hrefModalObj.hrefType ? <Col span={6}>
                            <FormItem >
                                <span><span style={{ fontSize: 12 }}>跳转类型:</span> {objhref[query.linkType]}</span>
                            </FormItem>
                        </Col> : null}
                    </Row>
                    {hrefModalObj.linkUrl ? <Row>
                        <FormItem>
                            <span><span style={{ fontSize: 12, marginLeft: '8%' }}>跳转Url: </span> {hrefModalObj.linkUrl}</span>
                        </FormItem>
                    </Row> : null}
                    <FormItem
                        {...formItemLayoutForTime}
                        label="生效时间"
                        extra={!query.wholeCountry ? "区域投放浮标广告的生效时间最多不超过15天" : "区域投放浮标广告的生效时间"}
                    >
                        {getFieldDecorator('effectiveTime', {
                            rules: [{ required: true, message: '请选择生效时间' },
                            ],
                            initialValue: query.startTime ? [moment(query.startTime, 'YYYY-MM-DD HH:mm:ss'), moment(query.endTime, 'YYYY-MM-DD HH:mm:ss')] : [],
                        })(
                            <RangePicker disabled={actionType == 'detail'} showTime={{
                                hideDisabledOptions: true,
                                defaultValue: [moment(null, 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],

                            }}
                                //   ranges={{ "今天后几分钟": [moment().add(5, 'm'), moment().add(15, 'd')], }}
                                format="YYYY-MM-DD HH:mm:ss" onChange={(date, dateString) => { dateChange(date, dateString) }}
                                onOk={(date) => {
                                    if (!query.wholeCountry) {
                                        if (date[1].diff(date[0], 'days') > 15) {
                                            query.startTime = null
                                            query.endTime = null
                                            dispatch({
                                                type: 'updateStore',
                                                payload: {
                                                    query
                                                }
                                            })
                                            form.resetFields(['effectiveTime'])
                                            message.error('设置生效日期的范围最长不能超过15天', () => {
                                            })
                                            return false
                                        }
                                    }

                                }}
                            />

                        )}
                    </FormItem>

                    <div >
                        <FormItem>
                            <Row>
                                <div style={{ "fontWeight": "600" }}>使用范围 <span style={{ fontSize: '12px', fontWeight: 400, marginLeft: '12px' }}>{tip}</span></div>
                            </Row>
                        </FormItem>
                        {formItems}
                        {actionType == 'detail' ? null :
                            <FormItem required='true'>
                                {getFieldDecorator('useRange', {
                                    rules: [{
                                        validator: function (rule, str, callback) {
                                            if (query.wholeCountry || query.provinceCodes.length > 0) {
                                                callback();
                                            } else {
                                                callback('请选择城市范围');
                                            }
                                        }//todo
                                    }
                                    ],
                                })(
                                    <Button type='primary' onClick={() => add()}>新增活动范围</Button>)}
                            </FormItem>
                        }
                    </div>
                </CollapsiblePanels>
            </div>
            {/*链接弹窗*/}
            <SelectModal
                visible={hrefModalObj.visible}
                updateModal={updateModal}
                pageProps={pageProps}
                hrefModalObj={hrefModalObj}
                form={form}
                channelIndex={channelIndex}
                changeState={changeState}
                confirmHref={confirmHref}
                currentItem={currentItem}
                type="advertisingWindow"
                location={'1'}
            />
            {/* 确认提交审核 */}
            <Modal
                visible={confirmAudit}
                onOk={() => confirmAuditOk()}
                cancelText="我再想想"
                okText="确认并提交"
                onCancel={() => {
                    dispatch({
                        type: `${namespace}/updateStore`,
                        payload: { confirmAudit: false }
                    })
                }}
            >
                <p>提交后需要集团审批通过方可生效，请检查图片是否符合以下要求：</p>
                <p>图片清晰美观；</p>
                <p>符合尺寸要求；</p>
                <p>符合美的置业云页面主题配色；</p>
            </Modal>
            {/* 驳回原因 */}
            <Modal
                visible={ignoreReason}
                title="驳回原因"
                onOk={() => confirmignore()}
                cancelText="取消"
                okText="确认"
                onCancel={() => {
                    dispatch({
                        type: `${namespace}/updateStore`,
                        payload: { ignoreReason: false }
                    })
                }}
            >
                <TextArea

                    onChange={(e) => onChangeTextArea(e.target.value)}
                    placeholder="请输入驳回原因"
                    rows={6}
                    autoSize={true}
                />
            </Modal>
        </div>
    )
}
// 连接视图(view)和模型(model)
export default connect(mapStateToProps)(Form.create()(buoyManagementDetailView))
